#ifndef RecordInfoMODEL_H
#define RecordInfoMODEL_H
#include<QAbstractTableModel>
#include<recordInfo.h>


class RecordInfoModel:public QAbstractTableModel
{
public:
    RecordInfoModel(const int totalColumn, const int aColumnNumWithChechBox = 0, QObject *parent = 0):totalColumn(totalColumn),colNumberWithCheckBox(aColumnNumWithChechBox),  QAbstractTableModel(parent) {rowCheckStateMap.clear();};


    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    Qt::ItemFlags flags(const QModelIndex &index) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role);


    void AddStudentInfo(const RecordInfo &studentInfo);


signals:
    void RecordInfoIsChecked(const RecordInfo &studentInfo);

private:
    typedef QVector<RecordInfo> RecordInfos;
    RecordInfos recordInfos;
    int totalColumn;
    int colNumberWithCheckBox;
    QMap<int, Qt::CheckState> rowCheckStateMap;
};

#endif // RecordInfoMODEL_H
